package com.keti.controller;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.keti.Dao.stuffDao;
import com.keti.DaoImpl.suffDaoImpl;
import com.keti.pojo.stuff;

/**
 * Servlet implementation class UpdataStuffServlet
 */
@WebServlet("/UpdataStuffServlet")
public class UpdataStuffServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 request.setCharacterEncoding("utf-8");
		  response.setContentType("text/html;charset=utf-8");
		  int id = Integer.parseInt(request.getParameter("id"));
		  String sname = request.getParameter("sname");
		  int count1 = Integer.parseInt(request.getParameter("count1"));
		  int count2 = Integer.parseInt(request.getParameter("count2"));
		  String status = request.getParameter("status");
		  stuff s = new stuff();
		  s.setId(id);
		  s.setSname(sname);
		  s.setCount1(count1);
		  s.setCount2(count2);
		  s.setStatus(status);
		  stuffDao sd = new suffDaoImpl();
		  sd.updata(s);;
		  response.sendRedirect("AdminInterfaceServlet");
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}
